Skip to main content

All Questions

Tagged with
12votes
3answers
6kviews

Natural Order Comparator

I've been looking for an implementation of Comparator that provides a "natural order". I found a couple but they were buggy or poorly designed. I wrote my own with ...
NonlinearFruit's user avatar
2votes
1answer
9kviews

Sorting the array of strings on their lengths in Java , Using Maps, ascending order....

I wrote the java method to answer this question : Write a Program to sort String on their length in Java? Your method should accept an array of String and return a sorted array based upon the length ...
user avatar
3votes
2answers
455views

Merge and sorting arrays of String and int in more efficient methods

Are there better methods for merge and sorting arrays of int and String in more efficient methods both time-complexity wise and ...
Mona Jalal's user avatar
6votes
3answers
5kviews

Sorting a String based on its words

Is there a better, more efficient or nicer way to do this? ...
Mona Jalal's user avatar
8votes
2answers
3kviews

String merge sort in Java

This snippet is about sorting a set of strings using merge sort. However, this version is tailored for strings as it relies on lcp values: Given two strings \$A\$ ...
coderodde's user avatar
6votes
3answers
5kviews

Quicksort for strings in Java

I have this implementation of Quicksort for strings. The algorithm sorts the requested range by first character, then by second, third, and so on. (Please, do not confuse this with radix sort; it is ...
coderodde's user avatar
7votes
2answers
2kviews

Project Euler 22: Names scores

Description of challenge: Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then ...
TheCoffeeCup's user avatar
8votes
4answers
27kviews

Arranging words in sentences alphabetically

For an online contest whose problem is here, I wrote some code. In this problem the input will consist of a number of lines of English text consisting of the letters of the English alphabet, the ...
RE60K's user avatar
  • 1,466
10votes
2answers
41kviews

Count frequency of words in a given file

Write a function that takes two parameters: a String representing a text document an integer providing the number of items to return Implement the ...
wayfare's user avatar
12votes
4answers
33kviews

Number aware string sorting with comparator

I have this class for use in sorting strings such that if strings have a number in the same position it will order the numbers in increasing order. Alphabetical gives: file1 file10 file2 What I'm ...
pbible's user avatar
4votes
3answers
2kviews

Sorting strings in a one dimensional array

What are the better solutions possible? I have a character array with different strings. There is a max size for the strings. In case a string is smaller than max size remaining places are filled ...
varsh's user avatar

close